package com.lottery.ruok.lottrey.adapter.fragmentManager;

import com.lottery.ruok.lottrey.fragment.ChargeItemsFragment;
import com.lottery.ruok.lottrey.retrofitModule.response.GetPayTypeResponse;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class ChargeFragmentManager {

//    public static final int TYPE_ARTIFICIAL = 0;//
//    public static final int TYPE_ONE_PAY = 1;
//    public static final int TYPE_THREE_PAY = 2;

    private static HashMap<Integer, ChargeItemsFragment> map = new HashMap<>();
    private static List<GetPayTypeResponse> data;

    public static ChargeItemsFragment getFragment(int key) {
        if (map.containsKey(key)) {
            return map.get(key);
        }
        ChargeItemsFragment fragment = null;
        fragment = new ChargeItemsFragment();
        map.put(key, fragment);
        return fragment;
    }

    public static void setMoney(String money) {
        Iterator<Map.Entry<Integer, ChargeItemsFragment>> entries = map.entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry<Integer, ChargeItemsFragment> entry = entries.next();
            entry.getValue().setMoney(money);
        }
    }

    public static void setData(List<GetPayTypeResponse> source) {
        data = source;
    }

    public static void clear() {
        map.clear();
    }


}
